﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MenuByAdministratorRoles.aspx.cs" Inherits="GPSTrackingWebsiteManager.Manager.Pages.MenuByAdministratorRoles" %>

<!DOCTYPE html>

<link href="../../Css/GPSTrackingWebsite.css" rel="stylesheet" />
<link href="../../Css/messi.css" rel="stylesheet" />
<script src="../../Javascript/jquery-1.11.1.min.js"></script>
<script src="../../Javascript/messi.js"></script>
<script src="../../Javascript/Custom.js"></script>
<script src="../../Javascript/WindowMessageManager.js"></script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
        <script type="text/javascript">
            function resizeGrid() {
                var height = window.innerHeight;
                var width = window.innerWidth;

                var tableView = $find("<%=AdminRolesGrid.ClientID %>");
                tableView.get_element().style.height = height + "px";
                tableView.get_element().style.width = (width / 3) + "px";

                var tableView2 = $find("<%=AllMenuGrid.ClientID %>");
                tableView2.get_element().style.height = height + "px";
                tableView2.get_element().style.width = (width / 3) + "px";

                var tableView3 = $find("<%=MenuGrid.ClientID %>");
                tableView3.get_element().style.height = height + "px";
                //tableView3.get_element().style.width = width-((width / 3)*2) + "px";

                document.getElementById('HiddenFieldHeight').value = height;
                document.getElementById('HiddenFieldWidth').value = width;
        }

        //Windows Message Manager 
            var objWindowsMessageManager = new WindowsMessageManager();

            function MenuRadManagerTreeView_OnClientNodeClicked(sender, args)
            {
                document.getElementById('HiddenFieldTreeViewHasFocus').value = "Manager";
            }

            function MenuRadMapTreeView_OnClientNodeClicked(sender, args) {
                document.getElementById('HiddenFieldTreeViewHasFocus').value = "Map";
                
            }

            function AllMenuRadManagerTreeView_OnClientNodeClicked(sender, args) {
                document.getElementById('HiddenFieldTreeViewHasFocus').value = "AllManager";
            }

            function AllMenuRadMapTreeView_OnClientNodeClicked(sender, args) {
                document.getElementById('HiddenFieldTreeViewHasFocus').value = "AllMap";

            }
            

        </script>
    </telerik:RadScriptBlock>
</head>
<body onresize="resizeGrid()" style="overflow: hidden">
    <form id="form1" runat="server">
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="AdminRolesGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldHeight" UpdatePanelCssClass="" />
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldError" UpdatePanelCssClass="" />
                        <telerik:AjaxUpdatedControl ControlID="rmpRoles" LoadingPanelID="RadAjaxLoadingPanel1" UpdatePanelCssClass="" />
                        
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="AllMenuGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldHeight" UpdatePanelCssClass="" />
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldError" UpdatePanelCssClass="" />
                        <telerik:AjaxUpdatedControl ControlID="rmpRoles" LoadingPanelID="RadAjaxLoadingPanel1" UpdatePanelCssClass="" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="MenuGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldHeight" UpdatePanelCssClass="" />
                        <telerik:AjaxUpdatedControl ControlID="HiddenFieldError" UpdatePanelCssClass="" />
                        <telerik:AjaxUpdatedControl ControlID="rmpRoles" LoadingPanelID="RadAjaxLoadingPanel1" UpdatePanelCssClass="" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
        <asp:HiddenField ID="HiddenFieldHeight" runat="server" Value="500" />
        <asp:HiddenField ID="HiddenFieldWidth" runat="server" Value="500" />
        <asp:HiddenField ID="HiddenFieldError" runat="server" />
        <asp:HiddenField ID="HiddenFieldTreeViewHasFocus" runat="server" />       
        
        <telerik:RadTabStrip ID="rtsRoles" runat="server" SelectedIndex="0" MultiPageID="rmpRoles" ></telerik:RadTabStrip>
        <telerik:RadMultiPage ID="rmpRoles" runat="server" SelectedIndex="0">
        <telerik:RadPageView ID="rpvRoles" runat="server">
        
        <div>
            <table border="0" CellSpacing="0" GridLines="None">
                <tr>
                    <td>
                        
			            <telerik:RadGrid ID="AdminRolesGrid" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100%" Width="100%" AllowSorting="true" GroupingSettings-CaseSensitive="false" OnNeedDataSource="AdminRolesGrid_NeedDataSource" OnSelectedIndexChanged="AdminRolesGrid_SelectedIndexChanged" OnInsertCommand="AdminRolesGrid_InsertCommand" OnDeleteCommand="AdminRolesGrid_DeleteCommand" OnUpdateCommand="AdminRolesGrid_UpdateCommand"> 
                            <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
                                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling>
                                <Selecting AllowRowSelect="True"></Selecting>
                                <ClientEvents OnPopUpShowing="PopUpShowing" />
                            </ClientSettings>

                            <MasterTableView EditMode="PopUp" EditFormSettings-PopUpSettings-Modal="true" EditFormSettings-CaptionFormatString="Modo Edición" CommandItemDisplay="TopAndBottom" NoMasterRecordsText="No hay registros" AllowFilteringByColumn="true" TableLayout="Auto">
                                <CommandItemTemplate>
                                    <div style="padding: 5px 5px;">
                                        Roles de Admin: 
                                            <asp:LinkButton ID="lbAdd" runat="server" CommandName="InitInsert" Visible='<%# !AdminRolesGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/text-plus-icon.png"/>Nuevo Rol de Admin</asp:LinkButton>
                                        <asp:LinkButton ID="lbClearAdminRolesFilters" runat="server" OnClick="lbClearAdminRolesFilters_Click" Visible='<%# !AdminRolesGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/mixx-icon.png"/>Limpiar Filtros</asp:LinkButton>
                                        <asp:LinkButton ID="lbShowError" runat="server" OnClick="lbShowError_Click" Visible='<%# HiddenFieldError.Value == string.Empty ? false : true %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/bug-icon.png"/>Error Técnico</asp:LinkButton>
                                    </div>
                                </CommandItemTemplate>

                                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>

                                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </ExpandCollapseColumn>

                                <Columns>
                                    <telerik:GridEditCommandColumn ButtonType="ImageButton" EditText="Editar" HeaderStyle-Width="20px" />
                                    <telerik:GridButtonColumn HeaderStyle-Width="25px" ConfirmText="¿Desea eliminar el registro?" ConfirmDialogType="RadWindow" ConfirmDialogHeight="120" ConfirmDialogWidth="270" ConfirmTitle="Eliminar" ButtonType="ImageButton" CommandName="Delete" Text="Eliminar" ItemStyle-Width="20px" ></telerik:GridButtonColumn>
                                    <telerik:GridBoundColumn DataField="AdministratorRoleId" FilterControlAltText="Filter GPSModelID column" HeaderText="Role ID" UniqueName="AdministratorRoleId" ItemStyle-Width="100px" Display="false" ReadOnly="true" ForceExtractValue="Always">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Name column" HeaderText=" Role" UniqueName="Name" HeaderStyle-Width="200px" MaxLength="50" FilterControlWidth="180px" CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true">
                                        <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                            <RequiredFieldValidator ForeColor="Red" ErrorMessage="* Requerido" SetFocusOnError="true"></RequiredFieldValidator>
                                        </ColumnValidationSettings>
                                    </telerik:GridBoundColumn>
                                </Columns>

                                <EditFormSettings>
                                    <EditColumn InsertText="Agregar" UpdateText="Actualizar" CancelText="Cancelar" ButtonType="ImageButton"></EditColumn>
                                </EditFormSettings>
                            </MasterTableView>
                            <ClientSettings>
                                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling>
                            </ClientSettings>
                            <FilterMenu EnableImageSprites="False"></FilterMenu>
                        </telerik:RadGrid>
			
                    </td>
                    <td>&nbsp</td>
                    <td>
			            <telerik:RadGrid ID="AllMenuGrid" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100%" Width="100%" AllowSorting="true" GroupingSettings-CaseSensitive="false" OnNeedDataSource="AllMenuGrid_NeedDataSource" OnItemCommand="AllMenuGrid_ItemCommand" OnDataBound="AllMenuRadManagerTreeView_DataBound">
                            <MasterTableView CommandItemDisplay="TopAndBottom" AllowFilteringByColumn="false">
                                <CommandItemTemplate>
                                    <div style="padding: 5px 5px;">
                                        Items: 
                                        <asp:LinkButton ID="lbAddRole" runat="server" CommandName="AddRole"  Visible='<%# !AdminRolesGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/text-plus-icon.png"/>Agregar</asp:LinkButton>
                                        <asp:LinkButton ID="lbExpandAllNodes" runat="server" CommandName="ExpandAllNodes"  Visible='<%# !AdminRolesGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/arrow-expand-icon.png"/>Expandir</asp:LinkButton>
                                        <asp:LinkButton ID="lbCollapseAllNodes" runat="server" CommandName="CollapseAllNodes"  Visible='<%# !AdminRolesGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/arrow-expand-icon.png"/>Colapsar</asp:LinkButton>
                                        <asp:LinkButton ID="lbShowError" runat="server" OnClick="lbShowError_Click" Visible='<%# HiddenFieldError.Value == string.Empty ? false : true %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/bug-icon.png"/>Error Técnico</asp:LinkButton>
                                    </div>
                                </CommandItemTemplate>

                                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>

                                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </ExpandCollapseColumn>

                                <Columns>
                                    <telerik:GridTemplateColumn ShowFilterIcon="false">
                                        <ItemTemplate>
                                
                                            <telerik:RadTreeView ID="AllMenuRadManagerTreeView" runat="Server" OnClientNodeClicked="AllMenuRadManagerTreeView_OnClientNodeClicked" MultipleSelect="true">                                   
                                            </telerik:RadTreeView>
                                            <telerik:RadTreeView ID="AllMenuRadMapTreeView" runat="Server" MultipleSelect="true" OnClientNodeClicked="AllMenuRadMapTreeView_OnClientNodeClicked">                                   
                                            </telerik:RadTreeView>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                </Columns>

                                <EditFormSettings>
                                    <EditColumn InsertText="Agregar" UpdateText="Actualizar" CancelText="Cancelar" ButtonType="ImageButton"></EditColumn>
                                </EditFormSettings>
                            </MasterTableView>
                            <ClientSettings>
                                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling>
                            </ClientSettings>
                            <FilterMenu EnableImageSprites="False"></FilterMenu>
                        </telerik:RadGrid>

                    </td>
                    <td>&nbsp</td>
                    <td>
                        <telerik:RadGrid ID="MenuGrid" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100%" Width="100%" AllowSorting="true" GroupingSettings-CaseSensitive="false" OnNeedDataSource="MenuGrid_NeedDataSource" OnItemCommand="MenuGrid_ItemCommand">
                            <MasterTableView CommandItemDisplay="TopAndBottom" AllowFilteringByColumn="false">
                                <CommandItemTemplate>
                                    <div style="padding: 5px 5px;">
                                        Items: 
                                        <asp:LinkButton ID="lbRemoveRole" runat="server" CommandName="RemoveRole"  Visible='<%# !AdminRolesGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/Button-Delete-icon.png"/>Quitar</asp:LinkButton>
                                        <asp:LinkButton ID="lbExpandAllNodes" runat="server" CommandName="ExpandAllNodes"  Visible='<%# !AdminRolesGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/arrow-expand-icon.png"/>Expandir</asp:LinkButton>
                                        <asp:LinkButton ID="lbCollapseAllNodes" runat="server" CommandName="CollapseAllNodes"  Visible='<%# !AdminRolesGrid.MasterTableView.IsItemInserted %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/arrow-expand-icon.png"/>Colapsar</asp:LinkButton>
                                        <asp:LinkButton ID="lbShowError" runat="server" OnClick="lbShowError_Click" Visible='<%# HiddenFieldError.Value == string.Empty ? false : true %>'><img style="padding-left:10px; padding-right:5px; vertical-align:middle" alt="" src="../../Template/Icons/16px/bug-icon.png"/>Error Técnico</asp:LinkButton>
                                    </div>
                                </CommandItemTemplate>

                                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>

                                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </ExpandCollapseColumn>

                                <Columns>
                                    <telerik:GridTemplateColumn ShowFilterIcon="false">
                                        <ItemTemplate>
                                
                                            <telerik:RadTreeView ID="MenuRadManagerTreeView" runat="Server" OnClientNodeClicked="MenuRadManagerTreeView_OnClientNodeClicked" MultipleSelect="true" >                                   
                                            </telerik:RadTreeView>
                                            <telerik:RadTreeView ID="MenuRadMapTreeView" runat="Server" OnClientNodeClicked="MenuRadMapTreeView_OnClientNodeClicked" MultipleSelect="true" >                                   
                                            </telerik:RadTreeView>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                </Columns>

                                <EditFormSettings>
                                    <EditColumn InsertText="Agregar" UpdateText="Actualizar" CancelText="Cancelar" ButtonType="ImageButton"></EditColumn>
                                </EditFormSettings>
                            </MasterTableView>
                            <ClientSettings>
                                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling>
                            </ClientSettings>
                            <FilterMenu EnableImageSprites="False"></FilterMenu>
                        </telerik:RadGrid>
                    </td>
                </tr>
            </table>
        </div>
          
           
            
        </telerik:RadPageView>
        </telerik:RadMultiPage>                       
    </form>
</body>
</html>
